package de.haw.adt.implementation;

import de.haw.adt.interfaces.IAcc;

class Acc extends AbstractPhysicalScalar implements IAcc {

	private final double acc;

	@Override
	double getValue() {
		return acc;
	}
	
	private Acc(double acc) {
		this.acc = acc;
	}
	
	public int compareTo(IAcc acc) {
		return Double.compare(this.acc, acc.getMSs());
	}

	@Override
	public boolean equals(Object o) {
		if (o == this)
			return true;
		if (!(o instanceof IAcc))
			return false;
		return this.compareTo((IAcc) o) == 0;
	}

	public double getMSs() {
		return acc;
	}

	public IAcc add(IAcc acc) {
		return valueOf(this.acc + acc.getMSs());
	}

	public IAcc sub(IAcc acc) {
		return valueOf(this.acc - acc.getMSs());
	}

	public static IAcc valueOf(double acc) {
		return new Acc(acc);
	}
}
